<?php
use Yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
$this->title = '软件分类';
?>

 <div class="container">
    <div class="row">
       <?php echo $this->render('_leftnav'); ?>

        <div class="col-md-10">
          <div class="page-header clearfix">
            <h1 class="pull-left">软件分类</h1>
            <div class="pull-right">
                <a class="btn btn-success btn-sm" href="<?=Url::toRoute(['download/softcategory']);?>">添加分类</a>                                                
            </div>
          </div>
	<?php
	$form = ActiveForm::begin([
	'action' => ['download/softcatedel'],
	'method'=>'post',
	'options' => [
					'enctype' => 'multipart/form-data',
					'class'=>'form-horizontal'
				 ]	
		]);	
	?>          
          
          
<!-- <form class="well well-sm form-inline" action="/admin/article">
	<div class="form-group">
		<select class="form-control" name="categoryId">
		 <option selected="selected" value="">--所属栏目--</option>
		   					<option value="1">&nbsp;&nbsp;&nbsp;&nbsp;└─ EduSoho</option>
										<option value="3">&nbsp;&nbsp;&nbsp;&nbsp;└─ 行业资讯</option>
										<option value="2">&nbsp;&nbsp;&nbsp;&nbsp;└─ 默认分类</option>
							</select>
	</div>
	<div class="form-group">
		<input class="form-control" name="keywords" placeholder="标题关键词" type="text">
	</div>
	<div class="form-group">
		<select class="form-control" name="property">
		  <option selected="selected" value="">--属性--</option><option value="featured">头条</option><option value="promoted">推荐</option><option value="sticky">置顶</option>
		</select>
	</div>
	<div class="form-group">
		<select class="form-control" name="status">
		  <option selected="selected" value="">--发布状态--</option><option value="published">已发布</option><option value="unpublished">未发布</option><option value="trash">回收站</option>
		</select>
	</div>
	<button class="btn btn-primary" type="submit">搜索</button>

</form> -->

<div id="aticle-table-container">

<table class="table table-hover table-striped" id="article-table">
	<thead>
		<tr>
			<th width="10%">ID</th>
			<th width="20%">分类名称</th>
			<!-- <th width="15%">下载地址</th> -->
			<th width="15%">分类排序</th>
			<!-- <th width="10%">下载积分</th> -->
			<th width="18%">分类状态</th>
			<th width="15%">添加时间</th>
			<th width="10%">更新时间</th>
			<!-- <th width="10%">软件描述</th>		 -->	
			<th width="15%">操作</th>
		</tr>
	</thead>
	<tbody>	
<?php foreach($catelist as $key=>$val):?>
<tr id="article-<?=Html::encode($val['softcate_id'])?>" align='left'>
	<td>
		<input name='delid[]' value="<?=Html::encode($val['softcate_id'])?>" data-role="batch-item" type="checkbox">
	</td>
	<td>
		<span class="text-muted">
			<span><?=Html::encode($val['softcate_name'])?> </span>
		</span>
	</td>
	<td>
		<span class="text-muted">
			<span><?=Html::encode($val['softcate_sort'])?></span>
		</span>
	</td>
	<td>
		<?php if($val['softcate_status']==1){?>
		<span class="text-success">开启</span>
		<?php }else{ ?>
		<span class="text-success">关闭</span>
		<?php } ?>		
	</td>
	<td>
		<?=date('Y-m-d H:i:s',$val['softcate_addtime']);?>
	</td>

	<td>
		<?=date('Y-m-d H:i:s',$val['softcate_updtime']);?>
	</td>

	<td>
		<div class="btn-group">
		  <a href="<?=Url::toRoute(['download/softcateupd', 'id' =>$val['softcate_id']]);?>" class="btn btn-default btn-sm">编辑</a>
		  <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
		    <span class="caret"></span>
		  </a>
		  <ul class="dropdown-menu">
		  		     				    <li><a href="javascript:" data-role="unpublish-item" data-url="/admin/article/12/unpublish">取消发布</a></li>
		    		    			    <li><a href="javascript:" data-role="trash-item" data-url="/admin/article/12/trash">移至回收站</a></li>
		    		    		  </ul>
			</div>
		</td>
	</tr>
<?php endforeach; ?>
	</tbody>
   </table>
  <div>
    <label class="checkbox-inline"><input id="newsletter" type="checkbox" onclick='quan(this)'> 全选</label>
    <input class="btn btn-default btn-sm mlm" type='submit' value='删除' onclick='return delinfo()'>
<?php ActiveForm::end(); ?>
<div style=' margin-left:38%;'>
	 <?= LinkPager::widget(['pagination' => $pages]); ?>
	 </div> 
  </div>
  </div>
        </div>
          </div>
  </div>
  <script type="text/javascript">
  	 function delinfo(){
  	  	if(confirm('您确定要删除吗？')){   	  	  	 
			return true;
  	  	}else{
			return false;
  	  	}
  	 }
	 function quan(th) {
			 var arr = document.getElementsByName('delid[]');
			 for(var i=0; i<arr.length; i++){
				arr[i].checked = th.checked;
			 }
        }
  </script>